<template>
  <div>
      <div class="subsidy">
          <p class="subsidy-text">————  心选好店88元抢  ————</p>
          <div class="main"  >
              <div class="list" v-for="(v,i) in arr" :key="i">
                  <div class="list-title">心选好店</div>
                  <img :src="v.pic2" alt="">
                  <p class="list-text"><span>优选门店</span>{{v.gname | sub}}</p>
                  <p class="list-pirce">￥{{v.price2}}</p>
                  <p class="list-tag"><span>折扣</span><span>到店</span></p>
              </div> 
          </div>
          <div class="see"><button>查看全部心选好店></button></div>
      </div>
  </div>
</template>

<script>
import {getlink} from "@/api/getapi.js"
export default {
    data(){
       return{
           arr:[]
       }
   },
   mounted(){
       getlink("/api/findGoods").then((ok)=>{
           console.log(ok.data)
           this.arr=ok.data
           this.arr=this.arr.slice(0,3)
       })
   },
   filters:{
       sub(val){
           return val.substring(0,10)+"..."
       }
   },
   props:["img","text","pirce"]
}
</script>

<style scoped>
    .subsidy{
        width: 100%;
        background-color: #fe3869;
        height: 6.9rem;
    }
    .subsidy-text{
        text-align: center;
        font-size: 0.3rem;
        padding: 0.2rem 0;
        font-weight: bold;
    }
    .main{
        width: 92%;
        display: block;
        margin:0 0.3rem;
        display: flex;
        justify-content: space-evenly;
    }
    .list{
        width: 2rem;
        height: 3.62rem;
        border-radius: 00.1rem;
        background: #ffffff;
        position: relative;
    }
    .list img{
        width: 2rem;
        height: 2rem;
        border-radius: 00.1rem;
    }
    .list-title{
        position: absolute;
        left: 0;
        top: 00.1rem;
        background: #df318b;
        color: white;
        width: 1.2rem;
        font-size: 0.25rem;
        font-weight: bold;
        border-radius: 0.1rem;
    }
    .list-text span:nth-of-type(1){
        background: #fbc1aa;
        width: 1.1rem;
        display: inline-block;
        text-align: center;
        margin-left: 0.05rem;
        border-radius: 0.1rem;
    }
    .list-pirce{
        color: #f23030;
        font-size: 0.3rem;
        margin-left: 00.1rem;
    }
    .list-tag span:nth-of-type(1){
        border: red 0.03rem solid;
        width: 0.7rem;
        display: inline-block;
        color: red;
        text-align: center;
        border-radius: 0.1rem;
        margin-left: 0.1rem;
        margin-top: 0.1rem;
    }
    .list-tag span:nth-of-type(2){
        border: skyblue 0.03rem solid;
        width: 0.7rem;
        display: inline-block;
        color: skyblue;
        text-align: center;
        border-radius: 0.1rem;
        margin-left: 0.1rem;
        margin-top: 0.1rem;
    }

    /* see */
    .see{
        color: #ffffff;
        width: 2.5rem;
        margin: 0 auto;
        margin-top: 1.3rem;;

    }
    .see button{
        display: block;
        width: 2.5rem;
        height: 0.5rem;
        background: red;
        border: none;
    }
</style>